package com.imooc.miaoshaproject.response;

/**
 * 统一返回格式
 *
 * @author chenjianfei
 */
public class R {
    private String status;
    private Object data;

    private R() {
    }

    private static class RHolder {
        private static R instance = new R();
    }

    public static R getInstance() {
        return RHolder.instance;
    }

    public static R create(Object result) {
        return create(result, "success");
    }

    public static R create(Object result, String status) {
        R type = new R();
        type.setStatus(status);
        type.setData(result);
        return type;
    }

    public String getStatus() {
        return status;
    }

    private void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    private void setData(Object data) {
        this.data = data;
    }
}
